/**
 * 作用同redux reducer
 */
import {ADD, DEL} from './mutation-types'
let id = 2
export default {
  [ADD] (state, td) {
    if (!td.id) {
      td.id = ++id
    }
    state.tl.push(td)
  },
  [DEL] (state, td) {
    state.tl.forEach((v, k) => {
      if (v.id === td.id) {
        state.tl.splice(k, 1)
      }
    })
  }
}
